//
//  LotteryVC.m
//  WanCaiC8
//
//  Created by tangang on 2018/4/24.
//  Copyright © 2018年 tangang. All rights reserved.
//

#import "LotteryVC.h"
#import "LabCell.h"
#import "LotteryTopView.h"

#import "InformationVM.h"
#import "HomeTypeCell.h"
#import "LotteryHeadTitleView.h"
#import "AdvertisingView.h"

#import "AdvertisingNoImageCell.h"
#import "AdvertisingBigImageCell.h"
#import "AdvertisingSmallImageCell.h"
#import "AdvertisingMoreImageCell.h"
#import "ImageCell.h"
#import "PlanVC.h"
#import "MasterListVC.h"
#import "InfoTypeView.h"
#import "NewsMasterCell.h"
#import "PlanPeopleVC.h"
#import "LotteryPeopleHeadView.h"
#import "LotteryLayout.h"
#import "SocketRocketUtility.h"
@interface LotteryVC ()<UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout>
@property (nonatomic ,strong) UICollectionView  *collectionView;
///新闻图库列表
@property (nonatomic ,strong) NSMutableArray *newsPicArr;
///新闻栏目列表
@property (nonatomic ,strong) NSMutableArray *newsTypeArr;
@property (nonatomic ,strong) LotteryTopView *topView;

@property (nonatomic ,strong) NSArray        *advertisingArr;

//@property (nonatomic ,strong) AdvertisingView        *oneAdvertisingView;
//@property (nonatomic ,strong) AdvertisingView        *twoAdvertisingView;
@property (nonatomic ,strong) NSMutableArray         *peopleArr;
@property (nonatomic ,strong) InfoTypeView            *infoTypeView;
@property (nonatomic ,strong) NSArray                 *dataArr;



/**
 新增的高手排行榜 数组
 */
@property (nonatomic ,strong) NSArray                 *palyInfoArr;


@end

@implementation LotteryVC{
    NSInteger   selectNewsType;
    NSInteger   page;
    NSMutableArray *arr1;
    NSMutableArray *arr2;
    NSMutableArray *arr3;
    NSMutableArray *arr4;
    NSMutableArray *arr5;
    NSMutableArray *arr6;
    NSMutableArray *arr7;
    NSMutableArray *arr8;
}


- (void)viewDidLoad {
    [super viewDidLoad];
    page=1;
    
}





- (void)backClick{
    [super backClick];
    
}

- (void)cancleTimer{
    [self.topView cancleTimer];
}


- (void)setTypeModel:(NewsLottryTypeModel *)typeModel{
    _typeModel=typeModel;
    page=1;
    if (self.newsTypeArr.count==0) {
        
        
        [self getPlayInfo];
        
//        [self getNewsList];
        [self getLotteryNav];
    }
    [self getLotteryInfo];
}

#pragma mark -- 六合彩导航分类
- (void)getLotteryNav{
    WS(weakSelf);
    self.infoTypeView.lType=self.typeModel.Id;
    self.infoTypeView.name=self.typeModel.LTypeName;
    [[InformationVM manage] getLotteryNavListWithSuccess:^(id returnValue) {
        [weakSelf.infoTypeView setDataArr:returnValue];
        [weakSelf.collectionView reloadData];
        
    } andFail:^(NSString *errorMessage, NSError *error) {

    }];
}

#pragma mark - 新增6彩高手排行榜

-(void)getPlayInfo{
    WS(weakSelf);
    [[InformationVM manage] getPlayInfoWithlType:self.typeModel.Id Success:^(id returnValue) {
        
      
        weakSelf.palyInfoArr = [NSArray arrayWithArray:returnValue];
        
        
        dispatch_async(dispatch_get_global_queue(0, 0), ^{
            [self getNewsList];
        });

    } andFail:^(NSString *errorMessage, NSError *error) {
        
    }];
    
}

#pragma mark -- 获取新闻栏目列表
- (void)getNewsList{
    WS(weakSelf);
    [[InformationVM manage] getNewsTypeListWithId:self.typeModel.Id Success:^(id returnValue) {
        
        [weakSelf createData:returnValue];
    
    } andFail:^(NSString *errorMessage, NSError *error) {
        
    }];
}

- (void)createData:(NSMutableArray *)data{
    self.dataArr=data;
    [self.newsPicArr removeAllObjects];
    [self.newsTypeArr removeAllObjects];
    for (NewsTypeModel *model in data) {
       
        if (model.GroupType==0) {
            if (!([model.TypeName isEqualToString:@"香港挂牌"]||[model.TypeName isEqualToString:@"跑狗玄机"]||[model.TypeName isEqualToString:@"全年资料"]||[model.TypeName isEqualToString:@"常识规律"])) {
                [self.newsTypeArr addObject:model];
            }
            
        }else{
            [self.newsPicArr addObject:model];
        }
    }
    [self.collectionView reloadData];
    [self getAdvertising];
}

#pragma mark -- 获取广告
- (void)getAdvertising{
    WS(weakSelf);
    [[InformationVM manage] getAdvertWithLocation:@"-1" andType:3 Success:^(id returnValue) {
        weakSelf.advertisingArr=returnValue;
        [weakSelf insertAdvertising];
    } andFail:^(NSString *errorMessage, NSError *error) {
        
    }];
}

#pragma mark -- 插入广告
- (void)insertAdvertising{
    arr1=[[NSMutableArray alloc]init];
    arr2=[[NSMutableArray alloc]init];
    arr3=[[NSMutableArray alloc]init];
    arr4=[[NSMutableArray alloc]init];
    arr5=[[NSMutableArray alloc]init];
    arr6=[[NSMutableArray alloc]init];
    arr7=[[NSMutableArray alloc]init];
    arr8=[[NSMutableArray alloc]init];
    for (AdvertisingModel *model in self.advertisingArr) {
        if (model.Display) {
            if (model.Layer==1) {
                [arr1 addObject:model];
            }else if (model.Layer==2){
                [arr2 addObject:model];
            }else if (model.Layer==3){
                [arr3 addObject:model];
            }else if (model.Layer==4){
                [arr4 addObject:model];
            }else if (model.Layer==5){
                [arr5 addObject:model];
            }else if (model.Layer==6){
                [arr6 addObject:model];
            }else if (model.Layer==7){
                [arr7 addObject:model];
            }else if (model.Layer==8){
                [arr8 addObject:model];
            }
        }
    }
    [self.collectionView reloadData];
}

#pragma mark -- 获取彩种开奖信息
- (void)getLotteryInfo{
    WS(weakSelf);
    [[InformationVM manage] getLotteryInfoWithId:self.typeModel.LType Success:^(id returnValue) {
        [weakSelf.topView setLotteryModel:returnValue];
    } andFail:^(NSString *errorMessage, NSError *error) {
        
    }];
}



- (float)getViewHeight:(AdvertisingModel *)model{
    float height=0;
    if (model.ThumbStyle==0) {
        height =[TGTools getSpaceLabelHeight:model.Title withFont:[UIFont systemFontOfSize:real_size(15)] withWidth:SCREEN_WIDTH-27 andLineSpacing:5]+55;
        height-=33;
    }else if (model.ThumbStyle==1){
        height =[TGTools getSpaceLabelHeight:model.Title withFont:[UIFont systemFontOfSize:real_size(15)] withWidth:SCREEN_WIDTH-27-125 andLineSpacing:5]+55;
        
        height-=33;
        
        if (height<95) {
            height=95;
        }
        
    }else if (model.ThumbStyle==2){
        height =[TGTools getSpaceLabelHeight:model.Title withFont:[UIFont systemFontOfSize:real_size(15)] withWidth:SCREEN_WIDTH-27 andLineSpacing:5]+50+(SCREEN_WIDTH-22)/394.0*160;
        height-=33;
    }else if (model.ThumbStyle==3){
        height =[TGTools getSpaceLabelHeight:model.Title withFont:[UIFont systemFontOfSize:real_size(15)] withWidth:SCREEN_WIDTH-27 andLineSpacing:5]+50+(SCREEN_WIDTH-80)/3.0/105*75;
        height-=33;
    }else if (model.ThumbStyle==4){
        height=(SCREEN_WIDTH-22)/394.0*160+10;
    }
    
    return height;
}


#pragma mark - collectionView代理函数
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
    return 4;
}

-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    if (section==0) {
        return arr2.count;
    }else if (section==2){
        return self.newsPicArr.count+arr6.count;
    }else if (section == 1){
        return self.palyInfoArr.count +arr4.count;
    }
    
    return self.newsTypeArr.count+arr8.count;
}


-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section==0) {
        return [self cellWithModel:arr2[indexPath.row] andIndexPath:indexPath];
    }else if (indexPath.section==1){
        
        if (indexPath.row<self.palyInfoArr.count) {
            LabCell *cell=[collectionView dequeueReusableCellWithReuseIdentifier:@"LabCell" forIndexPath:indexPath];
            PlayRuleModel *model=self.palyInfoArr[indexPath.row];
            
            [cell setLineTitle:model.Name];
            return cell;
        } else {
            return [self cellWithModel:arr4[indexPath.row-self.palyInfoArr.count] andIndexPath:indexPath];
        }
        
        
    }else if (indexPath.section == 2){
        
        if (indexPath.row<self.newsPicArr.count) {
            LabCell *cell=[collectionView dequeueReusableCellWithReuseIdentifier:@"LabCell" forIndexPath:indexPath];
            NewsTypeModel *model=self.newsPicArr[indexPath.row];
            [cell setLineTitle:model.TypeName];
            return cell;
        }else{
            return [self cellWithModel:arr6[indexPath.row-self.newsPicArr.count] andIndexPath:indexPath];
        }
    }
    if (indexPath.row<self.newsTypeArr.count) {
        LabCell *cell=[collectionView dequeueReusableCellWithReuseIdentifier:@"LabCell" forIndexPath:indexPath];
        NewsTypeModel *model=self.newsTypeArr[indexPath.row];
        [cell setLineTitle:model.TypeName];
        return cell;
    }else{
        return [self cellWithModel:arr8[indexPath.row-self.newsTypeArr.count] andIndexPath:indexPath];
    }
}

- (UICollectionViewCell *)cellWithModel:(AdvertisingModel *)model andIndexPath:(NSIndexPath *)indexPach{
    if (model.ThumbStyle==0) {
        AdvertisingNoImageCell *cell=[self.collectionView dequeueReusableCellWithReuseIdentifier:@"AdvertisingNoImageCell" forIndexPath:indexPach];
        [cell setModel:model];
        [cell showLine:indexPach.row==0];
        return cell;
    }else if (model.ThumbStyle==1){
        AdvertisingSmallImageCell *cell=[self.collectionView dequeueReusableCellWithReuseIdentifier:@"AdvertisingSmallImageCell" forIndexPath:indexPach];
        [cell setModel:model];
        return cell;
        
    }else if (model.ThumbStyle==2){
        AdvertisingBigImageCell *cell=[self.collectionView dequeueReusableCellWithReuseIdentifier:@"AdvertisingBigImageCell" forIndexPath:indexPach];
        [cell setModel:model];
        return cell;
    }else if (model.ThumbStyle==3){
        AdvertisingMoreImageCell *cell=[self.collectionView dequeueReusableCellWithReuseIdentifier:@"AdvertisingMoreImageCell" forIndexPath:indexPach];
        [cell setModel:model];
        return cell;
    }else{
        ImageCell *cell=[self.collectionView dequeueReusableCellWithReuseIdentifier:@"ImageCell" forIndexPath:indexPach];
        if (model.ThumbList.count>0) {
            [cell.imageV sd_setImageWithURL:[NSURL URLWithString:model.ThumbList[0]] placeholderImage:[UIImage imageNamed:@"big_loding"]];
        }else{
            cell.imageV.image=[UIImage imageNamed:@"big_loding"];
        }
        return cell;
    }
}


- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.section==0) {
        return CGSizeMake(SCREEN_WIDTH, [self getViewHeight:arr2[indexPath.row]]);
    
    }else if (indexPath.section==2){
        if (indexPath.row<self.newsPicArr.count) {
            return CGSizeMake(SCREEN_WIDTH/3.0, 40);
        }else{
            return CGSizeMake(SCREEN_WIDTH, [self getViewHeight:arr6[indexPath.row-self.newsPicArr.count]]);
        }
    }else if (indexPath.section==1){
        if (indexPath.row<self.palyInfoArr.count) {
            return CGSizeMake(SCREEN_WIDTH/4.0, 40);
        }
        else{
            return CGSizeMake(SCREEN_WIDTH, [self getViewHeight:arr4[indexPath.row-self.palyInfoArr.count]]);
        }
    }
    if (indexPath.row<self.newsTypeArr.count) {
        return CGSizeMake(floor(SCREEN_WIDTH/3.0) , 40);
    }else{
        return CGSizeMake(SCREEN_WIDTH, [self getViewHeight:arr8[indexPath.row-self.newsTypeArr.count]]);
    }
    
}


-(UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section
{
    return UIEdgeInsetsMake(0, 0, 0, 0);
}

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section{
    if (section==0) {
        return CGSizeMake(SCREEN_WIDTH, real_size(140)+arr1.count*40);
    }
    return CGSizeMake(SCREEN_WIDTH, 45);
}

- (UICollectionReusableView *) collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
{

    UICollectionReusableView *reusableView = nil;
    
    if (kind == UICollectionElementKindSectionHeader)
    {
        if (indexPath.section==0) {
            LotteryPeopleHeadView *headerView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"LotteryPeopleHeadView" forIndexPath:indexPath];
            
            if (arr1.count>0) {
                headerView.adModelArr = arr1;
            }
            
            return headerView;
        }
        
        
        LotteryHeadTitleView *headerView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"LotteryHeadTitleView" forIndexPath:indexPath];
        if (indexPath.section==2) {
            [headerView setTitle:@"正版图库"];
           
            headerView.adModelArr = arr5;
        }else if (indexPath.section == 1){
            
            [headerView setTitle:@"高手排行榜"];
            headerView.adModelArr = arr3;
            
        }else{
            [headerView setTitle:@"免费资料"];
            headerView.adModelArr = arr7;
        }
         reusableView = headerView;
    }
    return reusableView;
}


-(void)adViewClickWith:(AdvertisingModel *)model{
    
    
    if (model.TransferUrl.length<1) {
        return;
    }
    
    if ([model.Title containsString:@"】"]) {
        
        UIPasteboard *copy = [UIPasteboard generalPasteboard];
        NSRange startRange = [model.Title rangeOfString:@"【"];
        NSRange endRange = [model.Title rangeOfString:@"】"];
        NSRange range = NSMakeRange(startRange.location + startRange.length, endRange.location - startRange.location - startRange.length);
        NSString *result = [model.Title substringWithRange:range];
        
        [copy setString:result];
        
        [SVProgressHUD showSuccessWithStatus:@"复制成功"];
        
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            [SVProgressHUD dismiss];
            [[UIApplication sharedApplication]openURL:[NSURL URLWithString: @"weixin://"]];
        });
        
    }else{
        if (model.TransferUrl.length<1) {
            return;
        }
        
        [[UIApplication sharedApplication]openURL:[NSURL URLWithString: model.TransferUrl]];
        
    }
    
}

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
    
    if (indexPath.section==0) {
        AdvertisingModel *model=arr2[indexPath.row];
        
        
        [self adViewClickWith:model];
        
        
    }
    else if (indexPath.section == 1){
        
        if (indexPath.row<self.palyInfoArr.count) {
            
            //进入高手计划
            MasterListVC *vc=[[MasterListVC alloc]init];
            vc.lType=self.typeModel.Id;
            vc.strTitle = self.typeModel.LTypeName;
            
            
            if (indexPath.row <=3) {
                
                
                vc.dic = @{@"selectRule":@"0",@"selectSubRule":[NSString stringWithFormat:@"%zd",indexPath.row],@"title":@"特码"};
                
            }else if (indexPath.row == 4){
                
                vc.dic = @{@"selectRule":@"1",@"selectSubRule":@"0",@"title":@"五不中"};
                
            }else{
                
                vc.dic = @{@"selectRule":@"2",@"selectSubRule":[NSString stringWithFormat:@"%zd",indexPath.row-5],@"title":@"生肖"};
            }
            
            
            [self.navigationController pushViewController:vc animated:YES];
            
        } else {
            
            AdvertisingModel *model=arr4[indexPath.row-self.palyInfoArr.count];
            
            
            [self adViewClickWith:model];
        
            
        }
        
       
        

        
    }
    
    else if (indexPath.section==2){
        if (indexPath.row<self.newsPicArr.count) {
            NewsTypeModel *model=self.newsPicArr[indexPath.row];
            for (int i=0; i<self.dataArr.count; i++) {
                NewsTypeModel *tModel=self.dataArr[i];
                if ([model.Id isEqualToString:tModel.Id]) {
                    model.index=i;
                    break;
                }
            }
            if (self.selectType) {
                self.selectType(model);
            }
        }else{
            AdvertisingModel *model=arr6[indexPath.row-self.newsPicArr.count];
            [self adViewClickWith:model];
//            PublicWebVC *vc=[[PublicWebVC alloc]init];
//            vc.url=model.TransferUrl;
//            [self.navigationController pushViewController:vc animated:YES];
        }
        
    }else if (indexPath.section==3) {
        if (indexPath.row<self.newsTypeArr.count) {
            NewsTypeModel *model=self.newsTypeArr[indexPath.row];
            for (int i=0; i<self.dataArr.count; i++) {
                NewsTypeModel *tModel=self.dataArr[i];
                if ([model.Id isEqualToString:tModel.Id]) {
                    model.index=i;
                    break;
                }
            }
            if (self.selectType) {
                self.selectType(model);
            }
        }else{
            AdvertisingModel *model=arr8[indexPath.row-self.newsTypeArr.count];
           
            
            [self adViewClickWith:model];
            
        }
    }
}



#pragma mark -- 懒加载
- (UICollectionView *)collectionView{
    if (!_collectionView) {
        LotteryLayout *layout = [[LotteryLayout alloc] init];
        layout.cellType=AlignWithLeft;
        [layout setItemSize:CGSizeMake(floor(SCREEN_WIDTH/3.0) , 40)];
        [layout setScrollDirection:UICollectionViewScrollDirectionVertical];
        layout.minimumInteritemSpacing = 0.0;
        layout.minimumLineSpacing = 0.0;
        _collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
        _collectionView.delegate = self;
        _collectionView.dataSource = self;
        _collectionView.backgroundColor=[UIColor whiteColor];
        _collectionView.showsVerticalScrollIndicator=NO;
        [_collectionView registerClass:[LabCell class] forCellWithReuseIdentifier:@"LabCell"];
        [_collectionView registerClass:[HomeTypeCell class] forCellWithReuseIdentifier:@"HomeTypeCell"];
        [_collectionView registerClass:[AdvertisingMoreImageCell class] forCellWithReuseIdentifier:@"AdvertisingMoreImageCell"];
        [_collectionView registerClass:[AdvertisingNoImageCell class] forCellWithReuseIdentifier:@"AdvertisingNoImageCell"];
        [_collectionView registerClass:[AdvertisingBigImageCell class] forCellWithReuseIdentifier:@"AdvertisingBigImageCell"];
        [_collectionView registerClass:[AdvertisingSmallImageCell class] forCellWithReuseIdentifier:@"AdvertisingSmallImageCell"];
        
        [_collectionView registerClass:[ImageCell class] forCellWithReuseIdentifier:@"ImageCell"];
        [_collectionView registerClass:[LotteryHeadTitleView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"LotteryHeadTitleView"];
        [_collectionView registerClass:[LotteryPeopleHeadView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"LotteryPeopleHeadView"];
        
        [self.view addSubview:_collectionView];
        [_collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.bottom.equalTo(self.view);
            make.top.equalTo(self.infoTypeView.mas_bottom).with.offset(5);
        }];
    }
    return _collectionView;
}

- (InfoTypeView *)infoTypeView{
    if (!_infoTypeView) {
        _infoTypeView=[[InfoTypeView alloc]init];
        WS(weakSelf);
        _infoTypeView.selectNav = ^(LotteryNavModel *model) {
            if (model.Type==2) {
                for (int i=0; i<weakSelf.dataArr.count; i++) {
                    NewsTypeModel *tModel=weakSelf.dataArr[i];
                    if ([model.Id isEqualToString:tModel.Id]) {
                        model.index=i;
                        break;
                    }
                }
            }
            if (weakSelf.selectNav) {
                weakSelf.selectNav(model);
            }
        };
        [self.view addSubview:_infoTypeView];
        [_infoTypeView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.equalTo(self.view);
            make.top.equalTo(self.topView.mas_bottom).with.offset(5);
            make.height.mas_equalTo(@(real_size(100)));
        }];
    }
    return _infoTypeView;
}


- (NSMutableArray *)newsTypeArr{
    if (!_newsTypeArr) {
        _newsTypeArr=[[NSMutableArray alloc]init];
    }
    return _newsTypeArr;
}

- (NSMutableArray *)newsPicArr{
    if (!_newsPicArr) {
        _newsPicArr=[[NSMutableArray alloc]init];
    }
    return _newsPicArr;
}

- (LotteryTopView *)topView{
    if (!_topView) {
        WS(weakSelf);
        _topView=[[LotteryTopView alloc]init];
//        _topView.updateBlock = ^{
//            [weakSelf getLotteryInfo];
//        };
//        if (!_topView.lotteryModel) {
//            [self getLotteryInfo];
//        }
        [self.view addSubview:_topView];
        [_topView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.equalTo(self.view);
            make.top.equalTo(self.view);
            make.height.mas_equalTo(@85);
        }];
    }
    return _topView;
}


//- (AdvertisingView *)oneAdvertisingView{
//    if (!_oneAdvertisingView) {
//        WS(weakSelf);
//        _oneAdvertisingView =[[AdvertisingView alloc]init];
//        _oneAdvertisingView.noTimel=YES;
//        self.oneAdvertisingView.changeHeight = ^(float height) {
//            [weakSelf.oneAdvertisingView mas_updateConstraints:^(MASConstraintMaker *make) {
//                make.height.mas_equalTo(@(height));
//            }];
//        };
//        [self.view addSubview:_oneAdvertisingView];
//        [_oneAdvertisingView mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.left.right.top.equalTo(self.view);
//            make.height.mas_equalTo(@0);
//        }];
//
//    }
//    return _oneAdvertisingView;
//}
//
//- (AdvertisingView *)twoAdvertisingView{
//    if (!_twoAdvertisingView) {
//        WS(weakSelf);
//        _twoAdvertisingView =[[AdvertisingView alloc]init];
//        _twoAdvertisingView.noTimel=YES;
//        self.twoAdvertisingView.changeHeight = ^(float height) {
//            [weakSelf.twoAdvertisingView mas_updateConstraints:^(MASConstraintMaker *make) {
//                make.height.mas_equalTo(@(height));
//            }];
//        };
//        [self.view addSubview:_twoAdvertisingView];
//        [_twoAdvertisingView mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.left.right.equalTo(self.view);
//            make.top.equalTo(self.topView.mas_bottom).with.offset(5);
//            make.height.mas_equalTo(@0);
//        }];
//    }
//    return _twoAdvertisingView;
//}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
